#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
     int fd = open("output.txt", O_CREAT | O_WRONLY | O_TRUNC, 0644);
     if(fd < 0)
     {
	     perror("open failed";
	     exit(1);
     }
     for(int i = 1; i < argc; i++)
     {
         write(fd, argv[i], strlen(argv[i]));
	 write(fd, "\n", 1);
     }
     close(fd);
     return 0;

}

